package com.woniuxy.ticketcinema.controller;


import com.woniuxy.ticketcinema.entity.Schedule;
import com.woniuxy.ticketcinema.service.ScheduleService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.ws.rs.GET;
import java.math.BigDecimal;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author yanqiwei
 * @since 2021-02-20
 */
@Slf4j
@RestController
@RequestMapping("/schedule")
public class ScheduleController {

    @Autowired
    private ScheduleService scheduleService;

    /**
     * 查询价格
     * @param id    排片id
     * @return      排片电影价格
     */
    @GetMapping("/getPrice/{id}")
    public BigDecimal getPrice(@PathVariable("id") int id){
        Schedule schedule = scheduleService.getById(id);
        log.info("查询价格");
        return schedule.getPrice();
    }

}

